package com.wind.cqboot.plugin;

import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;
import net.lz1998.cq.event.notice.CQGroupIncreaseNoticeEvent;
import net.lz1998.cq.robot.CQPlugin;
import net.lz1998.cq.robot.CoolQ;
import net.lz1998.cq.utils.CQCode;

@Slf4j
@Component
public class WelcomePlugin extends CQPlugin
{
    @Override
    public int onGroupIncreaseNotice(CoolQ cq, CQGroupIncreaseNoticeEvent event)
    {
        log.info("用户{}加入群", event.getUserId());
        Long groupId = event.getGroupId();
        Long userId = event.getUserId();
        String content = " 欢迎新人，别太客气，把这里当家一样。你最好把钱放在家里。"
                 + "请先阅读群公告，文档地址 http://doc.rycloud.zmrit.com/ "
                 + "演示环境地址 http://ruoyi.ant.zmrit.com "
                 + "启动演示视频 https://www.bilibili.com/video/av95044508/ "
                 + "如有疑问，请到issue提问。本群不提供基础教学,文档有提升教程地址," 
                 + "提问请整理好操作步骤、期望结果、实际结果。" 
                 + "最后，不要动不动就乱@管理员,可能获得机票！！！切忌！！";
        String result = CQCode.at(userId) + content;
        cq.sendGroupMsg(groupId, result, false);
        return super.onGroupIncreaseNotice(cq, event);
    }
}
